home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 November: Tool Chest / Dev.CD Nov 94.toast / Sample Code / Snippets / Toolbox / Password / Sample.r < prev   
Encoding:
Text File  |  1992-07-15  |  6.0 KB  |  269 lines  |  [TEXT/MPS ]

  1. /*------------------------------------------------------------------------------
  2. #
  3. #    Apple Macintosh Developer Technical Support
  4. #
  5. #    MultiFinder-Aware Simple Sample Application
  6. #
  7. #    Sample
  8. #
  9. #    Sample.r    -    Rez Source
  10. #
  11. #    Copyright © 1989 Apple Computer, Inc.
  12. #    All rights reserved.
  13. #
  14. #    Versions:    
  15. #                1.00                08/88
  16. #                1.01                11/88
  17. #                1.02                04/89
  18. #                1.03                06/89
  19. #
  20. #    Components:
  21. #                Sample.p            June 1, 1989
  22. #                Sample.c            June 1, 1989
  23. #                Sample.a            June 1, 1989
  24. #                Sample.inc1.a        June 1, 1989
  25. #                SampleMisc.a        June 1, 1989
  26. #                Sample.r            June 1, 1989
  27. #                Sample.h            June 1, 1989
  28. #                PSample.make        June 1, 1989
  29. #                CSample.make        June 1, 1989
  30. #                ASample.make        June 1, 1989
  31. #
  32. #    Sample is an example application that demonstrates how to
  33. #    initialize the commonly used toolbox managers, operate 
  34. #    successfully under MultiFinder, handle desk accessories, 
  35. #    and create, grow, and zoom windows.
  36. #
  37. #    It does not by any means demonstrate all the techniques 
  38. #    you need for a large application. In particular, Sample 
  39. #    does not cover exception handling, multiple windows/documents, 
  40. #    sophisticated memory management, printing, or undo. All of 
  41. #    these are vital parts of a normal full-sized application.
  42. #
  43. #    This application is an example of the form of a Macintosh 
  44. #    application; it is NOT a template. It is NOT intended to be 
  45. #    used as a foundation for the next world-class, best-selling, 
  46. #    600K application. A stick figure drawing of the human body may 
  47. #    be a good example of the form for a painting, but that does not 
  48. #    mean it should be used as the basis for the next Mona Lisa.
  49. #
  50. #    We recommend that you review this program or TESample before 
  51. #    beginning a new application.
  52. ------------------------------------------------------------------------------*/
  53.  
  54.  
  55. #include "Types.r"
  56.  
  57. #include "Sample.h"
  58.  
  59. /* we use an MBAR resource to conveniently load all the menus */
  60.  
  61. resource 'MBAR' (rMenuBar, preload) {
  62.     { mApple, mFile, mEdit, mPassword };    /* four menus */
  63. };
  64.  
  65.  
  66. resource 'MENU' (mApple, preload) {
  67.     mApple, textMenuProc,
  68.     AllItems & ~MenuItem2,    /* Disable dashed line, enable About and DAs */
  69.     enabled, apple,
  70.     {
  71.         "About Sample…",
  72.             noicon, nokey, nomark, plain;
  73.         "-",
  74.             noicon, nokey, nomark, plain
  75.     }
  76. };
  77.  
  78. resource 'MENU' (mFile, preload) {
  79.     mFile, textMenuProc,
  80.     MenuItem12,                /* enable Quit only, program enables others */
  81.     enabled, "File",
  82.     {
  83.         "New",
  84.             noicon, "N", nomark, plain;
  85.         "Open",
  86.             noicon, "O", nomark, plain;
  87.         "-",
  88.             noicon, nokey, nomark, plain;
  89.         "Close",
  90.             noicon, "W", nomark, plain;
  91.         "Save",
  92.             noicon, "S", nomark, plain;
  93.         "Save As…",
  94.             noicon, nokey, nomark, plain;
  95.         "Revert",
  96.             noicon, nokey, nomark, plain;
  97.         "-",
  98.             noicon, nokey, nomark, plain;
  99.         "Page Setup…",
  100.             noicon, nokey, nomark, plain;
  101.         "Print…",
  102.             noicon, nokey, nomark, plain;
  103.         "-",
  104.             noicon, nokey, nomark, plain;
  105.         "Quit",
  106.             noicon, "Q", nomark, plain
  107.     }
  108. };
  109.  
  110. resource 'MENU' (mEdit, preload) {
  111.     mEdit, textMenuProc,
  112.     NoItems,                /* disable everything, program does the enabling */
  113.     enabled, "Edit",
  114.      {
  115.         "Undo",
  116.             noicon, "Z", nomark, plain;
  117.         "-",
  118.             noicon, nokey, nomark, plain;
  119.         "Cut",
  120.             noicon, "X", nomark, plain;
  121.         "Copy",
  122.             noicon, "C", nomark, plain;
  123.         "Paste",
  124.             noicon, "V", nomark, plain;
  125.         "Clear",
  126.             noicon, nokey, nomark, plain
  127.     }
  128. };
  129.  
  130. resource 'MENU' (mPassword, preload) {
  131.     mPassword, textMenuProc,
  132.     NoItems,                /* disable everything, program does the enabling */
  133.     enabled, "Password",
  134.      {
  135.         "Two Item Password Dialog",
  136.             noicon, nokey, nomark, plain;
  137.         "Different Font Password Dialog",
  138.             noicon, nokey, nomark, plain;
  139.         "Internal Buffer Password Dialog",
  140.             noicon, nokey, nomark, plain
  141.     }
  142. };
  143.  
  144.  
  145. /* this ALRT and DITL are used as an About screen */
  146.  
  147. resource 'ALRT' (rAboutAlert, purgeable) {
  148.     {40, 20, 160, 290},
  149.     rAboutAlert,
  150.     { /* array: 4 elements */
  151.         /* [1] */
  152.         OK, visible, silent,
  153.         /* [2] */
  154.         OK, visible, silent,
  155.         /* [3] */
  156.         OK, visible, silent,
  157.         /* [4] */
  158.         OK, visible, silent
  159.     }
  160. };
  161.  
  162. resource 'DITL' (rAboutAlert, purgeable) {
  163.     { /* array DITLarray: 5 elements */
  164.         /* [1] */
  165.         {88, 180, 108, 260},
  166.         Button {
  167.             enabled,
  168.             "OK"
  169.         },
  170.         /* [2] */
  171.         {8, 8, 24, 214},
  172.         StaticText {
  173.             disabled,
  174.             "Simple Sample"
  175.         },
  176.         /* [3] */
  177.         {32, 8, 48, 237},
  178.         StaticText {
  179.             disabled,
  180.             "Copyright © 1989 Apple Computer"
  181.         },
  182.         /* [4] */
  183.         {56, 8, 72, 136},
  184.         StaticText {
  185.             disabled,
  186.             "Brought to you by:"
  187.         },
  188.         /* [5] */
  189.         {80, 24, 112, 167},
  190.         StaticText {
  191.             disabled,
  192.             "Macintosh Developer  Technical Support"
  193.         }
  194.     }
  195. };
  196.  
  197.  
  198. /* this ALRT and DITL are used as an error screen */
  199.  
  200. resource 'ALRT' (rUserAlert, purgeable) {
  201.     {40, 20, 120, 260},
  202.     rUserAlert,
  203.     { /* array: 4 elements */
  204.         /* [1] */
  205.         OK, visible, silent,
  206.         /* [2] */
  207.         OK, visible, silent,
  208.         /* [3] */
  209.         OK, visible, silent,
  210.         /* [4] */
  211.         OK, visible, silent
  212.     }
  213. };
  214.  
  215.  
  216. resource 'DITL' (rUserAlert, purgeable) {
  217.     { /* array DITLarray: 3 elements */
  218.         /* [1] */
  219.         {50, 150, 70, 230},
  220.         Button {
  221.             enabled,
  222.             "OK"
  223.         },
  224.         /* [2] */
  225.         {10, 60, 30, 230},
  226.         StaticText {
  227.             disabled,
  228.             "Sample - Error occurred!"
  229.         },
  230.         /* [3] */
  231.         {8, 8, 40, 40},
  232.         Icon {
  233.             disabled,
  234.             2
  235.         }
  236.     }
  237. };
  238.  
  239.  
  240. resource 'WIND' (rWindow, preload, purgeable) {
  241.     {60, 40, 290, 160},
  242.     noGrowDocProc, visible, noGoAway, 0x0, "Traffic"
  243. };
  244.  
  245.  
  246. /* here is the quintessential MultiFinder friendliness device, the SIZE resource */
  247.  
  248. resource 'SIZE' (-1) {
  249.     dontSaveScreen,
  250.     acceptSuspendResumeEvents,
  251.     enableOptionSwitch,
  252.     canBackground,                /* we can background; we don't currently, but our sleep value */
  253.                                 /* guarantees we don't hog the Mac while we are in the background */
  254.     multiFinderAware,            /* this says we do our own activate/deactivate; don't fake us out */
  255.     backgroundAndForeground,    /* this is definitely not a background-only application! */
  256.     dontGetFrontClicks,            /* change this is if you want "do first click" behavior like the Finder */
  257.     ignoreChildDiedEvents,        /* essentially, I'm not a debugger (sub-launching) */
  258.     not32BitCompatible,            /* this app should not be run in 32-bit address space */
  259.     reserved,
  260.     reserved,
  261.     reserved,
  262.     reserved,
  263.     reserved,
  264.     reserved,
  265.     reserved,
  266.     kPrefSize * 1024,
  267.     kMinSize * 1024    
  268. };
  269.